import request from '@/utils/request'
const ProductTagsServices = {
  actions: {
    /**
     * 商品标签分页
     */
    productTagsPage({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.get('productTags/page', params).then((res) => {
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    },
    /**
     * 商品标签新增
     */
    productTagsSave({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('productTags/save', params).then((res) => {
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    },
    /**
     * 商品标签修改
     */
    productTagsUpdate({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('productTags/update/' + params.id, {
          productId: params.productId,
          orders: params.orders,
          name: params.name
        }).then((res) => {
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    },
    /**
     * 商品标签删除
     */
    productTagsRemove({ commit }, ids) {
      return new Promise((resolve, reject) => {
        request.post('productTags/remove', ids).then((res) => {
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    }
  }
}
export default ProductTagsServices
